package com.test.demo.springbootdemo.controller;

import com.test.demo.springbootdemo.entity.User;
import com.test.demo.springbootdemo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/mybatis")
public class UserController {


    @Autowired
    private UserService userService;

    @GetMapping("/userList")
    public List<User> userList(){
        return userService.userList();
    }

    @GetMapping("/updateById")
    public User updateById(Long id,Integer age) throws Exception {
        return userService.updateById(id,age);
    }
}
